﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Javavaj.iHunter.Core
{
    internal class FilterWrapper : PluginWrapper, IFilter
    {
        IFilter filter;
        public FilterWrapper(IFilter filter)
            : base(filter)
        {
            this.filter = Plugin as IFilter;
        }


        #region IFilter 成员

        public int Rank(IMessage message)
        {
            try
            {
                return filter.Rank(message);
            }
            catch (Exception e)
            {
                OnPluginError(e);
                return 100;

            }
        }

        public void Train(IMessage message, bool isUseful)
        {
            try
            {
                filter.Train(message, isUseful);
            }
            catch(Exception e)
            {
                OnPluginError(e);

            }
        }

        #endregion
    }
}
